package com.qianwei.footpath.event;

import com.qianwei.footpath.bean.BodyCompositionData;

/**
 * 串口事件类
 *
 * 该类用于封装与串口通信相关的事件信息。
 * 可能的用途包括：
 * 1. 表示串口数据接收完成的事件。
 * 2. 包含串口通信中的错误信息或状态更新。
 * 3. 作为事件总线（如 Otto、EventBus）中的事件对象，用于在不同组件间传递串口相关的信息。
 */
public class SerialPortEvent {
    // 基础事件
    public static class ErrorEvent {
        public final String message;
        public ErrorEvent(String message) {
            this.message = message;
        }
    }

    public static class ProtocolErrorEvent {
        public final int errorCode;
        public final String errorMsg;
        public ProtocolErrorEvent(int errorCode, String errorMsg) {
            this.errorCode = errorCode;
            this.errorMsg = errorMsg;
        }
    }

    // 体重相关事件
    public static class WeightDataEvent {
        public final double value;
        public WeightDataEvent(double value) {
            this.value = value;
        }
    }

    public static class RealTimeWeightEvent {
        public final double value;
        public RealTimeWeightEvent(double value) {
            this.value = value;
        }
    }

    public static class WeightCompletionEvent {
        public final double finalValue;
        public WeightCompletionEvent(double finalValue) {
            this.finalValue = finalValue;
        }
    }

    // 身高相关事件
    public static class HeightDataEvent {
        public final double value;
        public HeightDataEvent(double value) {
            this.value = value;
        }
    }

    public static class HeightCompletionEvent {
        public final double finalValue;
        public HeightCompletionEvent(double finalValue) {
            this.finalValue = finalValue;
        }
    }

    // 体成分事件
    public static class HandCompletionEvent {
        public final BodyCompositionData data;
        public HandCompletionEvent(BodyCompositionData data) {
            this.data = data;
        }
    }

    // 心率事件
    public static class HeartRateEvent {
        public final int value;
        public HeartRateEvent(int value) {
            this.value = value;
        }
    }

    public static class HeartRateCompletionEvent {
        public final int finalValue;
        public HeartRateCompletionEvent(int finalValue) {
            this.finalValue = finalValue;
        }
    }

    // 电极接触事件
    public static class ElectrodeContactEvent {
        public final boolean success;
        public final int status;
        public ElectrodeContactEvent(boolean success, int status) {
            this.success = success;
            this.status = status;
        }
    }

    public static class PeelWeightCompleteEvent{}
}